package com.example.safeassistan.home.adapter;

import androidx.annotation.Nullable;

import com.chad.library.adapter.base.BaseQuickAdapter;
import com.chad.library.adapter.base.BaseViewHolder;
import com.example.safeassistan.R;
import com.example.safeassistan.home.model.MyBackLogListModel;

import java.util.List;

public class BackLogAdapter  extends BaseQuickAdapter<MyBackLogListModel.ResultDTO,BaseViewHolder> {
    public BackLogAdapter( @Nullable List<MyBackLogListModel.ResultDTO> data) {
        super(R.layout.item_backlog_list, data);
    }

    @Override
    protected void convert(BaseViewHolder helper, MyBackLogListModel.ResultDTO item) {
        String frequency="";
        if (item.getCheckFrequency()!=null){
            switch (item.getCheckFrequency()){
                case 1:
                    frequency="天";
                    break;
                case 2:
                    frequency="周";
                    break;
                case 3:
                    frequency="月";
                    break;
                case 4:
                    frequency="季";
                    break;
                case 5:
                    frequency="半年";
                    break;
                case 6:
                    frequency="年";
                    break;
            }
        }

        if (item.getCheckCount()==null){
            item.setCheckCount(0);
        }
        helper.setText(R.id.tvCheckRate,item.getScheduleCurrentCount()+"/"+item.getCheckCount());
        helper.setText(R.id.tvFrequency,"每"+frequency);
        helper.setText(R.id.tvType,item.getCheckTypeName());
        helper.setText(R.id.tvCheckName,item.getDefName());
        helper.setText(R.id.tvpPsitionName,"岗位:"+item.getPositionName());
    }
}